package test_package;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.testng.Assert;

/**
 * Created by iryna on 3/29/14.
 */
public class RegistrationPage {

    private WebDriver driver;
    public RegistrationPage(WebDriver driver){
        this.driver = driver;

    }



    public MyPage registrationValid(String login, String email, String password){
        WebElement inputElement = driver.findElement(By.name("title"));
        inputElement.clear();
        inputElement.sendKeys(login);

        Assert.assertEquals(login, inputElement.getAttribute("value"));

        WebElement inputElement2 = driver.findElement(By.name("email"));
        inputElement2.clear();
        inputElement2.sendKeys(email);

        Assert.assertEquals(email, inputElement2.getAttribute("value"));

        WebElement inputElement3 = driver.findElement(By.name("password"));
        inputElement3.clear();
        inputElement3.sendKeys(password);

        Assert.assertEquals(password, inputElement3.getAttribute("value"));


        driver.findElement(By.xpath("/html/body/div[1]/div/div/div[2]/div/div/div[2]/div/form/div[6]/button")).click();



        return new MyPage(driver);
    }

}
